package com.ktjy.aop;

import org.aspectj.lang.ProceedingJoinPoint;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Date;

public class TimeSpanAspect {
    Logger logger= LoggerFactory.getLogger(LoggerAspect.class);
    public Object t5(ProceedingJoinPoint jp) throws Throwable {
        long startTime=System.currentTimeMillis();
        logger.info("代码开始执行时间："+new Date(System.currentTimeMillis()));

        //执行目标方法
        Object proceed = jp.proceed();

        long endTime=System.currentTimeMillis();
        logger.info("代码结束执行时间："+new Date(System.currentTimeMillis()));

        logger.info("代码执行时间："+(endTime-startTime));
        return proceed;
    }
}
